package com.lanca.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;


@RestController
public class UserController {

    private static final Logger log = LoggerFactory.getLogger(UserController.class);

    @GetMapping("user")
    public String demoOrder() {
        System.out.println("user demo");
        // 调用订单服务 localhost：9999/order
        RestTemplate restTemplate = new RestTemplate();
        String forObject = restTemplate.getForObject("http://localhost:9999/order", String.class);
        log.info("订单调用成功：{}", forObject);

        return "user user demo OK! 调用成功 " + forObject;
    }
}
